<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 
<%@ include file="/decorators/taglib.jsp"%>
<html>
<script language="javascript"> 
    var jsonMyPagination;
    var myparams; 
    $(function()         
        {    
            $("#expaccordion").accordion(     
            {                
                header: "h3"                                                              
            });              
            $(":text:first").focus();              
            initEvent();     
            $('.ui-button-exp').button();  
            var likebox=$(":checkbox[name=listcheck]");
            var allcheck=$(":checkbox[name=allcheck]");
            
    
            $(allcheck).bind("click",function()
            {
                if($(allcheck).attr("checked"))
                {
                    $(":checkbox[name=listcheck]").each(function(){
                        $(this).attr("checked",true);
                    });
                }
                else
                {
                    $(":checkbox[name=listcheck]").each(function(){
                        $(this).attr("checked",false);
                    });
                }
            }); 
        });    
    $(document).ready(function() 
    {
        $("#queryForm").validationEngine('attach', 
        {
            bindMethod:"live",
            onValidationComplete: function(form, status)
            {
                if(status)
                    {
                    var params = $("#queryForm").serialize();                                   
                    params = decodeURI(params);                                                   
                    myparams = params;  
                    initEvent();  
                    }
            }
        })
    });          
    function initEvent()
    {    
            jsonMyPagination = $("#expdatagrid").myPagination(                            
            {                
                cssStyle: "exp",                                                          
                panel:       
                    {        
                        tipInfo_on: true,                                                   
                        tipInfo: '&nbsp;&nbsp;跳{input}/{sumPage}页',                       
                        tipInfo_css:                                                        
                            {
                                width: '25px',                                                
                                height: "20px",                                             
                                border: "2px solid #f0f0f0",                                
                                padding: "0 0 0 5px",                                       
                                margin: "0 5px 0 5px",                                      
                                color: "#666"
                            }
                    },       
                debug: false,
                ajax:       
                   {        
                        on: true,                                                           
                        url: '<c:url value="/expmemo/getGrid.action"/>',             
                        dataType: 'json',                                                   
                        param: myparams,                                                    
                        ajaxStart: function()                                               
                           {
                               ZENG.msgbox.show(" 正在加载中，请稍后...", 6, 10000);     
                           },                                                              
                        ajaxStop: function()                                                
                            { 
                                setTimeout(function()                                         
                                  {                                                           
                                      ZENG.msgbox.hide();                                     
                                  }, 120000);                                                 
                            },                                                              
                        callback: function(data)                                            
                            {
          
                               $("#mytab tbody").setTemplateElement("Template-List").processTemplate(data);                                                           
                               $('#mytab tbody').addClass('TrHover');                     
                               $("#mytab tbody tr").addClass("odd");                  
                               $("#mytab tbody tr:even").addClass("even");            
                               $('#mytab tbody tr').click(function()                      
                                    {                                                         
                                        $(".Expselected").removeClass("Expselected");     
                                        $(this).toggleClass("Expselected");                 
                                    });                                                       
                                ZENG.msgbox.hide();                                       
                            }
                }          
          });             
    }               
    function query()       
          {                
            $("#queryForm").submit();     
          }                
    function add()       
    {  
        $("#expParamForm").attr("action","<c:url value="/expmemo/initadd.action"/>");
        $("#expParamForm").submit();
    }       
    function delall()       
    {  
        var delId = "";  
        $(":checkbox[name=listcheck]").each(function()
        {
            if($(this).attr("checked"))
            {
               delId=delId+"|"+$(this).val();
            }
        });  
        if(delId == "")
        {
         alert("请选择需要删除的记录！");
        }
        else
        {
            $("#delFlag").val(delId);
            $("#expParamForm").attr("action","<c:url value="/expmemo/delall.action"/>");
            $("#expParamForm").submit();      
        }       
    }    
    function del(id)       
    {  
        var delId = "|"+id;  
        $("#delFlag").val(delId);
        $("#expParamForm").attr("action","<c:url value="/expmemo/del.action"/>");
        $("#expParamForm").submit();          
    }   
    function modify(id)       
        {  
            $("#delFlag").val(id);
            $("#expParamForm").attr("action","<c:url value="/expmemo/initmodify.action"/>");
            $("#expParamForm").submit();          
        }               

</script>
<body>

    <form id="expParamForm" name="expParamForm" method="post" action="">  
        <input type="hidden" id="delFlag" name="delFlag" />  
    </form>             
    <form id="queryForm" name="queryForm" method="post" action="javascript:void(0);"> 
      <table width="100%" id="tab">                                                       
        <thead >               
          <tr>
            <th colspan="6" style="font-size:14px; text-shadow:700;text-align: left;">查询条件</th>    
          </tr>                
        </thead>               
        <tbody>                
          <tr>
            <td class="one">id:</td>                                                  
            <td colspan="2" class="two"><input class="validate[optional,custom[integer]]" type="text" id="id" name="id"  value="" /></td>                                          
            <td colspan="3" style="text-align: right;"> 
              <input type="button" class="ui-button-exp" value="查询" onclick="query();"/>&nbsp;              
              <input type="button" class="ui-button-exp" value="增加" onclick="add();"/>&nbsp;                
              <input type="button" class="ui-button-exp" value="删除" onclick="delall();"/>&nbsp;      
              <input type="reset" class="ui-button-exp" value="重置" />&nbsp;                          
          </td>                
          </tr>              
         <tr class="tr_edd">
           <td class="one">exptype:</td>
           <td class="two" colspan="2">
             <input type="text" id="exptype" name="exptype" class="validate[optional]" value="" /></td>

           <td class="one">title:</td>
           <td class="two" colspan="2">
             <input type="text" id="title" name="title" class="validate[optional]" value="" /></td>
         </tr>
         <tr class="tr_edd">
           <td class="one">content:</td>
           <td class="two" colspan="2">
             <input type="text" id="content" name="content" class="validate[optional]" value="" /></td>

           <td class="one">expstate:</td>
           <td class="two" colspan="2">
             <input type="text" id="expstate" name="expstate" class="validate[optional]" value="" /></td>
         </tr>
         <tr class="tr_edd">
           <td class="one">remindertime:</td>
           <td class="two" colspan="2">
             <input type="text" id="remindertime" name="remindertime" class="validate[optional]" value="" /></td>

           <td class="one">priority:</td>
           <td class="two" colspan="2">
             <input type="text" id="priority" name="priority" class="validate[optional]" value="" /></td>
         </tr>
         <tr class="tr_edd">
           <td class="one">isdel:</td>
           <td class="two" colspan="2">
             <input type="text" id="isdel" name="isdel" class="validate[optional]" value="" /></td>

           <td class="one">createuserid:</td>
           <td class="two" colspan="2">
             <input type="text" id="createuserid" name="createuserid" class="validate[optional]" value="" /></td>
         </tr>
         <tr class="tr_edd">
           <td class="one">updateuserid:</td>
           <td class="two" colspan="2">
             <input type="text" id="updateuserid" name="updateuserid" class="validate[optional]" value="" /></td>

           <td class="one">createtime:</td>
           <td class="two" colspan="2">
             <input type="text" id="createtime" name="createtime" class="validate[optional]" value="" /></td>
         </tr>
         <tr class="tr_edd">
           <td class="one">updatetime:</td>
           <td class="two" colspan="2">
             <input type="text" id="updatetime" name="updatetime" class="validate[optional]" value="" /></td>

           <td class="one">frequency:</td>
           <td class="two" colspan="2">
             <input type="text" id="frequency" name="frequency" class="validate[optional]" value="" /></td>
         </tr>

        </tbody>               
      </table>
    </form>   
      <table width="100%" id="mytab" class="t1">                                        
          <thead>  
            <th><input type="checkbox" name="allcheck" value=""/></th>      
            <th>id</th>
            <th>exptype</th>
            <th>title</th>
            <th>content</th>
            <th>expstate</th>
            <th>remindertime</th>
            <th>priority</th>
            <th>isdel</th>
            <th>createuserid</th>
            <th>updateuserid</th>
            <th>createtime</th>
            <th>updatetime</th>
            <th>frequency</th>

            <th width="60px;">操作</th>
          </thead>             
          <tbody>              
          </tbody>             
      </table>
    <div id="expdatagrid"></div>                                                          
    <!-- Templates -->       
    <p style="display:none">                                                              
        <textarea id="Template-List" rows="0" cols="0">                               
            <!--               
            {#template MAIN} 
                {#foreach $T.result as Result}                                              
                    <tr>
                      <td><input type="checkbox" name="listcheck" value="{$T.Result.id}"/></td>
                      <td>{$T.Result.id}</td>
                      <td>{$T.Result.exptype}</td>
                      <td>{$T.Result.title}</td>
                      <td>{$T.Result.content}</td>
                      <td>{$T.Result.expstate}</td>
                      <td>{$T.Result.remindertime}</td>
                      <td>{$T.Result.priority}</td>
                      <td>{$T.Result.isdel}</td>
                      <td>{$T.Result.createuserid}</td>
                      <td>{$T.Result.updateuserid}</td>
                      <td>{$T.Result.createtime}</td>
                      <td>{$T.Result.updatetime}</td>
                      <td>{$T.Result.frequency}</td>


                      <td><a href="#" onclick="del({$T.Result.id})">删除</a>&nbsp;<a href="#" onclick="modify({$T.Result.id})">修改</a></td>
                    </tr>              
                {#/for}      
            {#/template MAIN}
            -->                
        </textarea>          
    </p>    

</body>
</html>
